import { createRouter, createWebHistory } from 'vue-router'
import Login from '../components/login/Login.vue'
import Index from '../components/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path:'/index',
      name:'index',
      component: Index,
      children:[
        // 子路由配置可以在这里添加
        {
          path: 'press',
          name: 'press',
          component: () => import('../components/press/Press.vue')
        },
        {
          path: 'user',
          name: 'user',
          component: () => import('../components/user/User.vue')
        },
        {
          path: 'book',
          name: 'book',
          component: () => import('../components/book/Book.vue')
        },
        {
          path: 'book-category',
          name: 'bookCategory',
          component: () => import('../components/book/BookCategory.vue')
        },
        {
          path: 'book-collect',
          name: 'bookCollect',
          component: () => import('../components/book/BookCollect.vue')
        },
        {
          path: 'book-feedback',
          name: 'bookFeedback',
          component: () => import('../components/book/BookFeedback.vue')
        },
        {
          path: 'book-resource',
          name: 'bookResource',
          component: () => import('../components/book/BookResource.vue')
        },
        {
          path: 'member',
          name: 'member',
          component: () => import('../components/member/Member.vue')
        },
        {
          path: 'memb-receipt',
          name: 'membReceipt',
          component: () => import('../components/member/MembReceipt.vue')
        },
        {
          path: 'order',
          name: 'order',
          component: () => import('../components/order/Order.vue')
        },
        {
          path: 'shop-cart',
          name: 'shopCart',
          component: () => import('../components/order/ShopCart.vue')
        },
        {
          path: 'demo',
          name: 'demo',
          component: () => import('../components/demo/demo.vue')
        }
      ]
    }
  ],
})

export default router
